﻿@model IEnumerable<BlogLite.Models.Database.Post>

@{ ViewBag.Title = "Home Page"; }

<div class="left" id="content_outer">
	<div id="content">
        @{
            foreach (var post in Model)
            {
                <div class="post">
			        <div class="post_title"><h2><a href="/Post/@post.PostId">@post.Subject</a></h2></div>
			        <div class="post_date">Posted on @post.PostDate.ToShortDateString() by @post.User.DisplayName</div>
			        <div class="post_body">
				       @Html.Raw(post.Content)
			        </div>
			        <div class="post_meta">
				        <a href="#">@post.Comments.Count comments</a> | Tagged:         
                        @foreach (var tags in post.Tags) {
                            @tags.TagName @:&nbsp;                         
                        }                        
			        </div>
		        </div>
            }            
        }				
	</div>
</div>
<div class="right" id="sidebar_outer">
	<div id="sidebar">
		<div class="box">
            @{ 
                // We'll need to make this section configurable in the admin                
            }
			<div class="box_title">About</div>
			<div class="box_content">
				<p></p>
			</div>
		</div>
		<div class="box">
			<div class="box_title">Tags</div>
			<div class="box_content">
				<ul>
					@{
                        // Need to think really hard about if we want to use the ViewBag for this
                        // if we implement other pages that use this section, the ViewBag is probably
                        // the best place for this instead of duplicating this in a ViewModel.  
                        // ** Ethan just loves <dynamic> **
                        foreach (var tag in ViewBag.Tags as IEnumerable<BlogLite.Models.Database.Tag>)
                        {
                            @Html.ActionLink(tag.TagName, "/", new { controller = "Tags", action = "Index", id = @tag.TagName })<br />
                        }
                     }
				</ul>
			</div>
		</div>
		<div class="box">
			<div class="box_title">Ads</div>
			<div class="box_content">
				<ul>					
				</ul>
			</div>
		</div>		
	</div>
</div>
<div class="clearer">&nbsp;</div>